Executed: Mon Mar 27 11:40:02 2017
Duration: 194 seconds.
In [1]:
from fretbursts import *
In [2]:
import os
from IPython.display import display
%matplotlib inline
In [3]:
from IPython.html.widgets import interact, interactive, fixed
from IPython.html import widgets
from IPython.display import display
from IPython.utils.traitlets import link
In [4]:
import lmfit
print('lmfit version:', lmfit.__version__)
In [5]:
PLOT_DIR = './figure/'
In [6]:
import seaborn as sns
#%run -i styles/style.py
#np.set_printoptions(formatter={'float': lambda x: '%6.2f'%x})
import matplotlib as mpl
# brewer2mpl.get_map args: set name set type number of colors
#bmap = brewer2mpl.get_map('Set1', 'qualitative', 9)
bmap = sns.color_palette("Set1", 9)
colors = np.array(bmap)[(1,0,2,3,4,8,6,7), :]
In [7]:
if mpl.__version__.startswith('1.4'):
mpl.rcParams['axes.color_cycle'] = list(colors)
else:
# Version 1.5 or later
from cycler import cycler
mpl.rcParams['axes.prop_cycle'] = cycler('color', colors)
In [8]:
colors_labels = ['blue', 'red', 'green', 'violet', 'orange', 'gray', 'brown', 'pink', ]
for c, cl in zip(colors, colors_labels):
locals()[cl] = tuple(c) # assign variables with color names
sns.palplot(colors)
Data folder:
In [9]:
data_dir = './data/multispot/'
Check that the folder exists:
In [10]:
data_dir = os.path.abspath(data_dir) + '/'
assert os.path.exists(data_dir), "Path '%s' does not exist." % data_dir
List of data files in data_dir
:
In [11]:
from glob import glob
file_list = sorted(glob(data_dir + '*.hdf5'))
In [12]:
labels = ['7d', '12d', '17d', '22d', '27d', 'DO']
files_dict = {lab: fname for lab, fname in zip(sorted(labels), file_list)}
files_dict
Out[12]:
Analysis parameters:
In [13]:
## Background fit parameters
bg_kwargs_auto = dict(fun=bg.exp_fit,
time_s = 30,
tail_min_us = 'auto',
F_bg=1.7,
)
Processing and plot options:
In [14]:
plt.rc('savefig', dpi=75) # Changes the figure size in the notebook
savefig_kwargs = dict(dpi=200, bbox_inches='tight') # default save-figure options
In [15]:
data_id = '7d'
d7 = loader.photon_hdf5(files_dict[data_id])
d7.calc_bg(**bg_kwargs_auto)
In [16]:
dplot(d7, timetrace_bg);
for period in range(d7.nperiods):
dplot(d7, hist_bg, period=period, binwidth=50e-6, legend=False);
plt.legend(bbox_to_anchor=(1, 1),
bbox_transform=plt.gcf().transFigure)
xlim(0, 6);
In [17]:
data_id = '12d'
d12 = loader.photon_hdf5(files_dict[data_id])
d12.calc_bg_cache(**bg_kwargs_auto)
In [18]:
dplot(d12, timetrace_bg);
In [19]:
for period in range(d12.nperiods):
dplot(d12, hist_bg, period=period, binwidth=50e-6, legend=False);
plt.legend(bbox_to_anchor=(1, 1),
bbox_transform=plt.gcf().transFigure)
xlim(0, 6);
In [20]:
data_id = '17d'
d17 = loader.photon_hdf5(files_dict[data_id])
d17.calc_bg_cache(**bg_kwargs_auto)
In [21]:
dplot(d17, timetrace_bg);
In [22]:
for period in range(d17.nperiods):
dplot(d17, hist_bg, period=period, binwidth=50e-6, legend=False);
plt.legend(bbox_to_anchor=(1, 1),
bbox_transform=plt.gcf().transFigure)
xlim(0, 6);
In [23]:
data_id = '22d'
d22 = loader.photon_hdf5(files_dict[data_id])
d22.calc_bg_cache(**bg_kwargs_auto)
In [24]:
dplot(d22, timetrace_bg);
In [25]:
for period in range(d22.nperiods):
dplot(d22, hist_bg, period=period, binwidth=50e-6, legend=False);
plt.legend(bbox_to_anchor=(1, 1),
bbox_transform=plt.gcf().transFigure)
xlim(0, 6);
In [26]:
data_id = '27d'
d27 = loader.photon_hdf5(files_dict[data_id])
d27.calc_bg_cache(**bg_kwargs_auto)
In [27]:
dplot(d27, timetrace_bg);
In [28]:
for period in range(d27.nperiods):
dplot(d27, hist_bg, period=period, binwidth=50e-6, legend=False);
plt.legend(bbox_to_anchor=(1, 1),
bbox_transform=plt.gcf().transFigure)
xlim(0, 6);
In [29]:
data_id = 'DO'
do = loader.photon_hdf5(files_dict[data_id])
do.calc_bg_cache(**bg_kwargs_auto)
In [30]:
dplot(do, timetrace_bg);
In [31]:
for period in range(do.nperiods):
dplot(do, hist_bg, period=period, binwidth=50e-6, legend=False);
plt.legend(bbox_to_anchor=(1, 1),
bbox_transform=plt.gcf().transFigure)
xlim(0, 6);